<template>
  <div class="avue-sidebar">
<!--    <logo></logo>-->
    <el-scrollbar style="height:100%">
      <div v-if="validatenull(thisMenu)"
           class="avue-sidebar--tip">{{$t('menuTip')}}
      </div>
      <el-menu unique-opened
               :default-active="nowTagValue"
               mode="vertical"
               :show-timeout="200"
               :collapse="keyCollapse">
        <sidebar-item :menu="thisMenu"
                      :screen="screen"
                      first
                      :props="website.menu.props"
                      :collapse="keyCollapse"></sidebar-item>
        <li class="el-menu-item"
                      @click="setCollapse" style="position:fixed;bottom:30px;padding: 0 10px !important;">
          <div class="avue-breadcrumb"
               :class="[{ 'avue-breadcrumb--active': isCollapse }]"
               v-if="showCollapse">
            <i class="icon-navicon"></i>
          </div>
        </li>
      </el-menu>
    </el-scrollbar>
  </div>
</template>

<script>
    import {mapGetters, mapState} from "vuex";
    import logo from "../logo";
    import sidebarItem from "./sidebarItem";

    export default {
        name: "sidebar",
        components: {sidebarItem, logo},
        inject: ["index"],
        data() {
            return {};
        },
        created() {
            this.index.openMenu();
        },
        computed: {
            ...mapGetters(["isCollapse", "website", "thisMenu", "tag", "keyCollapse", "screen", "menuId"]),
            ...mapState({
                showCollapse: state => state.common.showCollapse
            }),
            nowTagValue: function () {
                return this.$router.$avueRouter.getValue(this.$route);
            }
        },
        methods: {
            setCollapse() {
                this.$store.commit("SET_COLLAPSE");
            }
        }
    };
</script>
<style lang="scss" scoped>
</style>

